﻿<ListView x:Class="FileListView.Views.FListView"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

          mc:Ignorable="d" 
          d:DesignHeight="300" d:DesignWidth="300"

          SnapsToDevicePixels="True"
          >
  <!-- KeyDown="LstFiles_KeyDown"
  ItemsSource="{Binding CurrentItems}"
  -->
  <ListView.Resources>
    <BooleanToVisibilityConverter x:Key="boolToVis" />
  </ListView.Resources>
  <ListView.View>
    <GridView>
      <GridView.ColumnHeaderContainerStyle>
        <Style>
          <Setter Property="FrameworkElement.Visibility" Value="Collapsed"/>
        </Style>
      </GridView.ColumnHeaderContainerStyle>
      <GridViewColumn Header="Filename" Width="Auto"><!-- x:Name="TheGVColumn" -->
        <GridViewColumn.CellTemplate>
          <DataTemplate>
            <DockPanel Width="Auto">
              <Image Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ListView}}, Path=DataContext.ShowIcons, Converter={StaticResource boolToVis}}"
                                   Margin="0" Source="{Binding Path=DisplayIcon}" SnapsToDevicePixels="True" 
                                   DockPanel.Dock="Left" Width="16" Height="16" 
                                 >
                <Image.InputBindings>
                  <MouseBinding MouseAction="LeftDoubleClick"
                                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ListView}}, Path=DataContext.BrowseDownCommand}"
                                CommandParameter="{Binding .}"/>
                  </Image.InputBindings>
              </Image>
              <TextBlock Text="{Binding DisplayName}" Width="Auto" SnapsToDevicePixels="True">
                <TextBlock.InputBindings>
                  <MouseBinding MouseAction="LeftDoubleClick"
                                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ListView}}, Path=DataContext.BrowseDownCommand}"
                                CommandParameter="{Binding .}"/>
                </TextBlock.InputBindings></TextBlock>
            </DockPanel>
          </DataTemplate>
        </GridViewColumn.CellTemplate>
      </GridViewColumn>
    </GridView>
  </ListView.View>
</ListView>
